#include "water_tank/water_tank.hpp"

WaterTank::WaterTank() {
  water_level_ = 25.0f;
  water_tank_state_ = WaterTankState::DOWN;
}

void WaterTank::updateWaterLevel() {
  if (water_tank_state_ == WaterTankState::UP) {
    water_level_ += delta_height_up_;
    if (water_level_ > max_water_level_) {
      water_level_ = max_water_level_;
      water_tank_state_ = WaterTankState::DOWN;
    }
  } else if (water_tank_state_ == WaterTankState::DOWN) {
    water_level_ -= delta_height_down_;
    if (water_level_ < 0.0f) {
      water_level_ = 0.0f;
    }
  }
}

void WaterTank::setWaterTankState(WaterTankState state) {
  water_tank_state_ = state;
}

float WaterTank::getWaterLevel() const { return water_level_; }